import "package:ct_pa_majordomo/config/theme_vars.dart";
import "package:flutter/cupertino.dart";
import "package:flutter/material.dart";

class ListItem extends StatelessWidget {
  final void Function()? onTap;
  const ListItem({super.key, this.onTap});

  @override
  Widget build(BuildContext context) {
    return GestureDetector(
      behavior: HitTestBehavior.opaque,
      onTap: () {
        if (onTap != null) onTap!();
      },
      child: Column(
        crossAxisAlignment: CrossAxisAlignment.start,
        children: [
          const Text("2024.09.25", style: TextStyle(color: ThemeVars.colorTextSec),),
          const SizedBox(height: 6,),
          Container(
            padding: const EdgeInsets.symmetric(horizontal: 10, vertical: 12),
            decoration: const BoxDecoration(
              borderRadius: BorderRadius.all(Radius.circular(5)),
              color: Colors.white,
            ),
            child: const Row(
              children: [
                DecoratedBox(
                  decoration: BoxDecoration(
                    color: ThemeVars.colorBackground,
                    borderRadius: BorderRadius.all(Radius.circular(50)),
                  ),
                  child: Icon(Icons.person, size: 50,),
                ),
                SizedBox(width: 10,),
                Expanded(
                    child: Column(
                      crossAxisAlignment: CrossAxisAlignment.start,
                      children: [
                        Row(
                          mainAxisAlignment: MainAxisAlignment.spaceBetween,
                          crossAxisAlignment: CrossAxisAlignment.center,
                          children: [
                            Text("费解", style: TextStyle(fontSize: 16,),),
                            Text("已失效", style: TextStyle(fontSize: 12, color: ThemeVars.colorError),),
                          ],
                        ),
                        SizedBox(height: 4,),
                        Row(
                          children: [
                            Text("2023.02.25 21:32", style: TextStyle(color: ThemeVars.colorTextTer, fontSize: 13),),
                            SizedBox(width: 10,),
                            Text("永久", style: TextStyle(color: ThemeVars.colorTextTer, fontSize: 13),),
                          ],
                        )
                      ],
                    )
                )
              ],
            ),
          ),
        ],
      )
    );
  }

}